package com.currency.admin.controller;


import com.currency.admin.pojo.dto.OAuthClientFeignDTO;
import com.currency.admin.pojo.entity.SysOauthClient;
import com.currency.admin.service.ISysOauthClientService;
import com.currency.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lan
 * @since 2021-12-10
 */
@Api(tags = "客户端接口")
@RestController
@RequestMapping("/api/v1/oauth-clients")
@Slf4j
public class SysOauthClientController {

    @Resource
    private ISysOauthClientService iSysOauthClientService;

    @ApiOperation(value = "客户端详情")
    @ApiImplicitParam(name = "clientId", value = "客户端id", required = true, paramType = "path", dataType = "String")
    @GetMapping("/{clientId}")
    public Result<OAuthClientFeignDTO> detail(@PathVariable String clientId) {
        OAuthClientFeignDTO oAuthClientFeignDTO = OAuthClientFeignDTO.from(iSysOauthClientService.getById(clientId));
        log.info("oAuthClientFeignDTO: {}", oAuthClientFeignDTO);
        return Result.success(oAuthClientFeignDTO);
    }
}
